<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList"%>
<%@ include file="/WEB-INF/views/tag.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改周报信息</title>
<LINK rel="stylesheet" type="text/css" href="${baseurl}js/easyui/styles/default.css">
<%@ include file="/WEB-INF/views/common_css.jsp"%>
<%@ include file="/WEB-INF/views/common_js.jsp"%>

<script type="text/javascript">
	/* 表单异步提交 */
	 $(function(){
		 $("#submit").click(function(){
	          $("#itemForm").ajaxSubmit({
	        	 url: "${pageContext.request.contextPath }/weeklog/save",
	             dataType: "html",//返回数据类型
	             //提交成功后回调函数
	             success: function(returnedDate){
	            	 
	            	 if(returnedDate=="success"){
	            		 $.messager.confirm('修改周报', '修改成功！是否关闭?', function(r){
	         				if (r){
	         					//关闭弹出修改框
	         					parent.closemodalwindow();
	         					//选中创建的列表框（并刷新）
	         					parent.parent.$('#tabs').tabs('select','我的周报');
	         					
	         				}
	         			});
	            		
	            	 }else{
	            		 $.messager.alert('修改周报',returnedDate,'info');
	            	 }
	            	 
	             }
	         }); 
		 });
     });
	 
</script>
</head>
<body>
	<div style="margin-top: -40px;">
	<form:form id="itemForm" method="POST" modelAttribute="weeklog">
		<br/><br/>
		<table width="1022px" border=1 align="center" style="border-collapse:collapse;">
			<thead><caption><h3>${vUser.userCompany.companyName }周报总结</h3></caption></thead>
			<tr>
				<td colspan="2">
					<b>公司:</b>&nbsp;${vUser.userCompany.companyName }
					&nbsp;&nbsp;&nbsp;&nbsp;
					<b>部门：</b>&nbsp;${department.departmentName }
					&nbsp;&nbsp;&nbsp;&nbsp;
					<b>岗位：</b>&nbsp;${job.jobName }
					&nbsp;&nbsp;&nbsp;&nbsp;
					<b>姓名：</b>&nbsp;${vUser.username }
				</td>
				<td>
					<b>自我评分：</b>&nbsp;<input type="text" name="myScore" value="${weeklog.myScore }" />
					<input type="hidden" name="weeklogId" value="${weeklog.weeklogId }" />
					<input type="hidden" name="_method" value="PUT">
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<b>起始时间:</b>&nbsp;<fmt:formatDate value="${weeklog.createtime}" pattern="yyyy-MM-dd" />
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<b>结束时间:</b>&nbsp;<fmt:formatDate value="${endtime}" pattern="yyyy-MM-dd" />
				</td>
				<td>
					<b>上级评分：</b>&nbsp;${weeklog.leadScore }
				</td>
			</tr>
			<tr>
				<td width="90px"><b>本周工作重点：</b>&nbsp;</td>
				<td colspan="2">
					<textarea style="resize: none;width: 922px;height: 60px;max-width: 922px;max-height: 60px;" name="mainContent">${weeklog.mainContent }</textarea>
				</td>
			</tr>

			<tr>
				<td align="center"><b>时间/星期</b>&nbsp;</td>
				<td align="center"><b>工作内容及进展情况简述</b></td>
				<td align="center"><b>工作中的需求与不足</b></td>
			</tr>
		<%
		ArrayList<String> week = new ArrayList<String>();
		week.add("周一");
		week.add("周二");
		week.add("周三");
		week.add("周四");
		week.add("周五");
		week.add("周六");
		week.add("周日");
		week.add("周日");
		request.setAttribute("week", week);
		
		%>
		<c:forEach items="${weeklog.daylogs}" var="item" varStatus="i"> 
			<tr>
				<input type="hidden" name="daylogs[${i.index }].daylogId" value="${item.daylogId }">
				<td align="center"><b>${week[i.index]}</b>&nbsp;</td>
				<td><textarea style="resize: none;width: 458px;height: 45px;max-width: 458px;max-height: 45px;" name="daylogs[${i.index }].content">${item.content }</textarea></td>
				<td><textarea style="resize: none;width: 458px;height: 45px;max-width: 458px;max-height: 45px;" name="daylogs[${i.index }].addContent">${item.addContent }</textarea></td>
			</tr>
		</c:forEach>
			<tr>
				<td><b>下周工作计划：</b>&nbsp;</td>
				<td colspan="2">
					<textarea style="resize: none;width: 922px;height: 60px;max-width: 922px;max-height: 60px;" name="planContent">${weeklog.planContent }</textarea>
				</td>
			</tr>

		</table>
		<br/>
		<div align="center">
		<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" id="submit">保存</a>
		</div>
	</form:form>
	</div>
</body>

</html>